package exceptions

import play.api.libs.json.{JsError, JsPath, JsonValidationError}

case class BusinessException(errorNo: Int,
                             errorMsg: String, track: Throwable) extends RuntimeException(errorMsg, track) {
  def this(errNo: Int, errMsg: String) {
    this(errNo, errMsg, null)
  }
}

class LoginNotFoundUserError() extends BusinessException(-2, "登录失败：没有找到对应的用户信息")

class UnLoginError() extends BusinessException(-1, "用户尚未登录")

class AuthErrorNoJurisdiction() extends BusinessException(-3, "验证失败：不具有要求的权限")

class BusinessDataEmptyError(val errMsg: String = "") extends BusinessException(-10, "空数据错误:" + errMsg)

class BusinessError(val errMsg: String = "") extends BusinessException(-99, errMsg)

class HttpParamsParseError(val errors: Seq[(JsPath, Seq[JsonValidationError])]) extends BusinessException(-400, "参数解析错误:"
  + JsError.toJson(errors))

class DataEmptyError(val msg: String = "") extends BusinessException(-11, msg + "数据不能为空或者空字符串")


